// 留言Model
import mongoose from "mongoose";

const { Schema } = mongoose;

const commentSchema = new Schema(
    {
        // 留言人
        name: {
            type: String,
            required: true,
        },
        // 留言邮箱
        email: {
            type: String,
            required: true,
        },
        // 留言内容
        content: {
            type: String,
            required: true,
        },
        // 留言状态
        status: {
            type: String,
            enum: ['approved', 'pending', 'rejected'],
            default: 'pending',
        },
    },
    {
        timestamps: true,
    }
)

// 如果没有就创建，否则就用旧的
export default mongoose.models.Comment || mongoose.model("Comment", commentSchema);